summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan/fixed_pipeline_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan/fixed_pipeline_state.h')
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.h76
1 files changed, 49 insertions, 27 deletions
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
index ab79fb8f3..98ea20b42 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
@@ -17,6 +17,15 @@ namespace Vulkan {
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
+struct DynamicFeatures {
+ bool has_extended_dynamic_state;
+ bool has_extended_dynamic_state_2;
+ bool has_extended_dynamic_state_2_extra;
+ bool has_extended_dynamic_state_3_blend;
+ bool has_extended_dynamic_state_3_enables;
+ bool has_dynamic_vertex_input;
+};
+
struct FixedPipelineState {
static u32 PackComparisonOp(Maxwell::ComparisonOp op) noexcept;
static Maxwell::ComparisonOp UnpackComparisonOp(u32 packed) noexcept;
@@ -133,6 +142,17 @@ struct FixedPipelineState {
struct DynamicState {
union {
u32 raw1;
+ BitField<0, 2, u32> cull_face;
+ BitField<2, 1, u32> cull_enable;
+ BitField<3, 1, u32> primitive_restart_enable;
+ BitField<4, 1, u32> depth_bias_enable;
+ BitField<5, 1, u32> rasterize_enable;
+ BitField<6, 4, u32> logic_op;
+ BitField<10, 1, u32> logic_op_enable;
+ BitField<11, 1, u32> depth_clamp_disabled;
+ };
+ union {
+ u32 raw2;
StencilFace<0> front;
StencilFace<12> back;
BitField<24, 1, u32> stencil_enable;
@@ -142,15 +162,11 @@ struct FixedPipelineState {
BitField<28, 1, u32> front_face;
BitField<29, 3, u32> depth_test_func;
};
- union {
- u32 raw2;
- BitField<0, 2, u32> cull_face;
- BitField<2, 1, u32> cull_enable;
- };
- // Vertex stride is a 12 bits value, we have 4 bits to spare per element
- std::array<u16, Maxwell::NumVertexArrays> vertex_strides;
void Refresh(const Maxwell& regs);
+ void Refresh2(const Maxwell& regs, Maxwell::PrimitiveTopology topology,
+ bool base_feautures_supported);
+ void Refresh3(const Maxwell& regs);
Maxwell::ComparisonOp DepthTestFunc() const noexcept {
return UnpackComparisonOp(depth_test_func);
@@ -168,25 +184,24 @@ struct FixedPipelineState {
union {
u32 raw1;
BitField<0, 1, u32> extended_dynamic_state;
- BitField<1, 1, u32> dynamic_vertex_input;
- BitField<2, 1, u32> xfb_enabled;
- BitField<3, 1, u32> primitive_restart_enable;
- BitField<4, 1, u32> depth_bias_enable;
- BitField<5, 1, u32> depth_clamp_disabled;
- BitField<6, 1, u32> ndc_minus_one_to_one;
- BitField<7, 2, u32> polygon_mode;
- BitField<9, 5, u32> patch_control_points_minus_one;
- BitField<14, 2, u32> tessellation_primitive;
- BitField<16, 2, u32> tessellation_spacing;
- BitField<18, 1, u32> tessellation_clockwise;
- BitField<19, 1, u32> logic_op_enable;
- BitField<20, 4, u32> logic_op;
+ BitField<1, 1, u32> extended_dynamic_state_2;
+ BitField<2, 1, u32> extended_dynamic_state_2_extra;
+ BitField<3, 1, u32> extended_dynamic_state_3_blend;
+ BitField<4, 1, u32> extended_dynamic_state_3_enables;
+ BitField<5, 1, u32> dynamic_vertex_input;
+ BitField<6, 1, u32> xfb_enabled;
+ BitField<7, 1, u32> ndc_minus_one_to_one;
+ BitField<8, 2, u32> polygon_mode;
+ BitField<10, 2, u32> tessellation_primitive;
+ BitField<12, 2, u32> tessellation_spacing;
+ BitField<14, 1, u32> tessellation_clockwise;
+ BitField<15, 5, u32> patch_control_points_minus_one;
+
BitField<24, 4, Maxwell::PrimitiveTopology> topology;
BitField<28, 4, Tegra::Texture::MsaaMode> msaa_mode;
};
union {
u32 raw2;
- BitField<0, 1, u32> rasterize_enable;
BitField<1, 3, u32> alpha_test_func;
BitField<4, 1, u32> early_z;
BitField<5, 1, u32> depth_enabled;
@@ -197,25 +212,28 @@ struct FixedPipelineState {
BitField<14, 1, u32> smooth_lines;
BitField<15, 1, u32> alpha_to_coverage_enabled;
BitField<16, 1, u32> alpha_to_one_enabled;
+ BitField<17, 3, Tegra::Engines::Maxwell3D::EngineHint> app_stage;
};
std::array<u8, Maxwell::NumRenderTargets> color_formats;
u32 alpha_test_ref;
u32 point_size;
- std::array<BlendingAttachment, Maxwell::NumRenderTargets> attachments;
std::array<u16, Maxwell::NumViewports> viewport_swizzles;
union {
u64 attribute_types; // Used with VK_EXT_vertex_input_dynamic_state
u64 enabled_divisors;
};
+
+ DynamicState dynamic_state;
+ std::array<BlendingAttachment, Maxwell::NumRenderTargets> attachments;
std::array<VertexAttribute, Maxwell::NumVertexAttributes> attributes;
std::array<u32, Maxwell::NumVertexArrays> binding_divisors;
+ // Vertex stride is a 12 bits value, we have 4 bits to spare per element
+ std::array<u16, Maxwell::NumVertexArrays> vertex_strides;
- DynamicState dynamic_state;
VideoCommon::TransformFeedbackState xfb_state;
- void Refresh(Tegra::Engines::Maxwell3D& maxwell3d, bool has_extended_dynamic_state,
- bool has_dynamic_vertex_input);
+ void Refresh(Tegra::Engines::Maxwell3D& maxwell3d, DynamicFeatures& features);
size_t Hash() const noexcept;
@@ -230,13 +248,17 @@ struct FixedPipelineState {
// When transform feedback is enabled, use the whole struct
return sizeof(*this);
}
- if (dynamic_vertex_input) {
+ if (dynamic_vertex_input && extended_dynamic_state_3_blend) {
// Exclude dynamic state and attributes
+ return offsetof(FixedPipelineState, dynamic_state);
+ }
+ if (dynamic_vertex_input) {
+ // Exclude dynamic state
return offsetof(FixedPipelineState, attributes);
}
if (extended_dynamic_state) {
// Exclude dynamic state
- return offsetof(FixedPipelineState, dynamic_state);
+ return offsetof(FixedPipelineState, vertex_strides);
}
// Default
return offsetof(FixedPipelineState, xfb_state);